package org.fioma.tree;

public abstract class SimpleInternalNode<L> extends SimpleNode<L> implements InternalNode<L> {

	Node<?>[] nodes;

	public SimpleInternalNode() {
		nodes = new Node<?>[4];
	}

	@Override
	public boolean isLeaf() {
		return false;
	}

	@Override
	public Node<?> nextNode(char letter) {
		return nextNode(Tools.transformToByte(letter));
	}

	@Override
	public Node<?> nextNode(byte letter) {
		return nodes[letter];
	}

	@Override
	public void setChild(Node<?> node, char letter) {
		setChild(node, Tools.transformToByte(letter));
	}

	@Override
	public void setChild(Node<?> node, byte letter) {
		nodes[letter] = node;
	}

}
